<%@ page import="net.lainiao.base.model.Account" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setAttribute("title","登录页面");
%>
<%@include file="../base/headstart.jsp"%>
<%@include file="../base/headend.jsp"%>
<div class="container-fluid">
    <div class="row" style="padding:5px 0;">
        <div class="text-center col-md-12">
            <a href="/account/add" class="btn btn-success">新增</a>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-bordered">
                <tr style="background-image: linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);">
                    <th>用户名</th>
                    <th>操作</th>
                </tr>
                <%
                    List<Account> list= (List<Account>) request.getAttribute("data");
                    for (int i=0;i<list.size();i++){
                        Account account=list.get(i);
                        %>
                        <tr>
                            <td><%=account.getUsername()%></td>
                            <td>
                                <a href="/account/del/<%=account.getId()%>" class="btn btn-default">删除</a>
                                <a href="/account/edit/<%=account.getId()%>" class="btn btn-default">编辑</a>
                            </td>
                        </tr>
                        <%
                    }
                %>
            </table>
            <div class="text-center" style="margin-top:-30px">
                <nav>
                    <ul class="pagination">
                        <li><a href="/account/index/1">&laquo;</a></li>
                        <%
                            Integer pageStart=(Integer)request.getAttribute("pageStart");
                            Integer pageEnd=(Integer)request.getAttribute("pageEnd");
                            Integer pageIndex=(Integer)request.getAttribute("pageIndex");
                            for (int i=pageStart;i<=pageEnd;i++){
                                if(i==pageIndex){
                        %>
                        <li class="active"><a href="/account/index/<%=i%>"><%=i%></a></li>
                        <%
                        }
                        else{
                        %>
                        <li><a href="/account/index/<%=i%>"><%=i%></a></li>
                        <%
                                }
                            }
                        %>
                        <li><a href="/account/index/${pageTotal}">&raquo;</a></li>
                    </ul>
                </nav>
            </div>
        </div>
    </div>

</div>
<%@include file="../base/footerstart.jsp"%>
<%@include file="../base/footerend.jsp"%>

